home *** CD-ROM | disk | FTP | other *** search
- .TOPIC:
- Script Examples & Explanations
-
- VBBS 6.12 Documentation -- 10-J-1
-
-
- ╔════════════════════════════════════════════════════════════════╗
- ║ CHAPTER TEN ANNEX J SCRIPT EXAMPLES & EXPLANATIONS ║
- ╚════════════════════════════════════════════════════════════════╝
-
- ╔════════════════════════════════════════════════════════════════╗
- ║ Note: While all the following scripts were written by other ║
- ║ authors they have all undergone modification to improve ║
- ║ their clarity and/or add in new features found in 6.12. ║
- ║ The first few scripts are general examples, while the ║
- ║ later group of scripts are specific examples of some of ║
- ║ the more complex scripting command sequences. ║
- ╚════════════════════════════════════════════════════════════════╝
-
- Question: How do I figure out if it is a user's birthday?
- Answer: Place this section of code into the script that you
- wish to have show the birthday greeting.
-
- !=============================================================
- ! Unknown Author
- !=============================================================
- $bmonth = $birthdate LEFT 2
- $month = $date LEFT 2
- $bday = $birthdate MID 4 LEFT 2
- $day = $date MID 4 LEFT 2
- TESTVAL $bmonth <> $month NOTNOW
- IFVAL $bday = $day THEN
- <place your birthday message here>
- ENDIF
- # NOTNOW
- !=============================================================
-
- Question: I would like to know when I have new messages to be
- validated for my networked subs when I log on.
- Answer: Place this section of code into your START.V file
- anywhere before you exit.
-
- !=============================================================
- ! Originally written by Ken 1@8051 VirtualNET
- !=============================================================
- testval $security < 254 nothere
- $found = "VALIDATE.0"
- findfirst $validmsg "c:\vbbs\data\validate.0"
- test $validmsg <> $found nothere
- # again
- tr
- getny $choice " 5New messages to VALIDATE. 6 Validate Now? "
- if $choice = "Y" then
- validate
- endif
- # NOTHERE
- !=============================================================
- ! Note: This ONLY works for VirtualNET message bases.
- !=============================================================
-
-
- VBBS 6.12 Documentation -- 10-J-2
-
-
- Question: How do I set up a simple downloads area for special
- files like virus scanners and compression utilities?
- Answer: Just edit the following script to show the correct paths
- and filenames for the files, add in the command to run
- the script from a function block (ex: G 001 2 SHOPPING).
- Then all you need to do is create a .MNU file (or a .ANS
- and .ASC pair) listing the user's choices and place it
- into your \TXT directory and away you go.
-
- !=============================================================
- ! Originally written by O. F. 1@2056 VirtualNET
- !=============================================================
- Example SHOP.MNU file:
-
- Available files for quick download are:
- A> ARJ230.EXE - Newest ARJ Compression Utility
- C> CLEAN102.ZIP - McAfee Virus Cleaning Utility
- F> FRIES.GIF - GIF of the lovable '-fries'
- G> GREMLIN.GIF - GIF of 'The (verbose tagline) Gremlin'
- P> PKZIP204G.EXE - Newest PKZip Compression Utility
- S> SCAN102.ZIP - McAfee Virus Scanning Utility
-
- !=============================================================
- tr $crlf
- menu shop
- tr $crlf
- rr $selection acfgpsq "Which file would you like ? <Q to quit>"
- IF $selection = a THEN
- DOWNLOAD d:\dloads\compress\arj230.exe
- ELSE
- IF $selection = c THEN
- DOWNLOAD d:\dloads\virus\clean102.zip
- ELSE
- IF $selection = f THEN
- DOWNLOAD d:\dloads\gifs\fries.gif
- ELSE
- IF $selection = g THEN
- DOWNLOAD d:\dloads\gifs\gremlin.gif
- ELSE
- IF $selection = p THEN
- DOWNLOAD d:\dloads\compress\pkz204g.exe
- ELSE
- IF $selection = s THEN
- DOWNLOAD d:\dloads\virus\scan102.zip
- ENDIF
- tr $crlf
- exit start
- ! Make sure the EXIT command above is to a .FB you have !!
- !=============================================================
-
-
- VBBS 6.12 Documentation -- 10-J-3
-
-
- Question: How can I enhance the chat call from my users? I like
- to know WHY they chatted me, even if I am not around.
- Answer: All you have to do is compile the following script as
- CHAT.V and then and change the line in your START.FB from
- 'l 001 1 ^pagesysop' to 'l 001 2 chat'.
-
- !=============================================================
- ! Originally written by B. B. Woof 1@5096 VirtualNET
- !=============================================================
- tr "Why do you wish to page " $sysop
- tr
- tr " >----------------------------------------------------<"
- rs $reason "=> "
- tr " >----------------------------------------------------<"
- test $reason = "" end
- $tst = $reason LEFT 5
- test $tst = " " end
- test $available = Y imhere
- tr
- tr $sysop " is not currently available, "
- go feed
- # imhere
- tr
- tr "Paging " $sysop
- do $count = 1 10
- ts " 2< 6< 2< 6* 2> 6> 2> " $bell
- loop
- tr
- tr " Please wait 10 seconds for " $sysop " to respond, "
- tr
- drawwaitbar 10
- do $a = 1 10
- ts "*"
- delay 1
- loop
- tr
- tr $sysop " doesn't seem to be answering..."
- # feed
- getyn $yn "Would you like to leave feedback? (Y/N/enter=yes)"
- tr
- if $yn = Y then
- $s = " and left feedback as well!"
- feedback
- else
- $s = " and did not leave feedback!"
- endif
- log $handle ", paged you at " $time " on " $date
- log "Chat reason: " $reason
- log $s
- tr
- # end
- exit start
- ! Make sure the EXIT command above is to a .FB you have !!
- !=============================================================
-
-
- VBBS 6.12 Documentation -- 10-J-4
-
-
- !==============================================================
- ! Buffer Example (see Section 5 for command descriptions)
- !==============================================================
- ! EMAIL.V This sends an E-mail to the Sysop. To do this we
- ! create a form letter in the buffer and then write
- ! the buffer contents to an E-mail addressed to the
- ! Sysop #1 account. Note the '!' are comment lines.
- !
- ! Create the form letter
- $Line1 = $Sysop & ","
- $Line2 = " I'm a new user and would really appreciate it"
- $Line3 = "if you would validate my account."
- $Line4 = " Thanks!"
- $Line5 = " " & $Handle
- ! Clear out any existing buffer contents
- Buffer Clear
- ! Write the text lines to the Buffer
- Buffer Append $Line1
- Buffer Append $Line2
- Buffer Append $Line3
- Buffer Append $Line4
- Buffer Append $Line5
- ! Position to the E-mail database
- SetEmail
- ! Save the buffer as E-mail to the sysop #1
- Save 1 $Node "Validation Request" 0 "" 1
- ! Clear out the buffer again
- Buffer Clear
- !==============================================================
-
-
- VBBS 6.12 Documentation -- 10-J-5
-
-
- !==============================================================
- ! File Editing Example (see Section 6 for command desc.)
- !==============================================================
- ! READ.V - Some examples of writing and reading from the
- ! buffer file.
- !
- $Where = $port ! this selects the buffer
- $File = "c:\vbbs\b" & $where & ".tmp" ! for the node you're on
- !
- ! Check to see if the file is there; if so, delete it.
- CHECKFILE $Len $File
- IFVAL $Len > 0 Then
- KILL $File
- ENDIF
- ! Build an new one, add one line, then close it.
- OPEN $File OUTPUT
- WRITE "Your Handle : " $handle
- CLOSE
- ! Now open it, add data to the end of it, then close it again.
- OPEN $File APPEND
- WRITE "The BBSName : " $bbsname
- WRITE "Your Baud Rate : " $baud
- WRITE "The Sysop's Name : " $sysop " and the time : " $time
- CLOSE
- ! Now re-open it, read the data back, print it, and close it.
- OPEN $File INPUT
- # Tag
- READ $Line
- TEST $Line = "!EOF!" End
- TR $Line
- GO Tag
- # End
- ! Now close and remove the file
- CLOSE
- KILL $File
- !==============================================================
-
- With very little work you could actually write an editor
- using the combination of the BUFFER commands and the commands
- above. The options are limitless once you set your mind to it.
-
-
- VBBS 6.12 Documentation -- 10-J-6
-
-
- !=============================================================
- ! Control Example (see Section 7 for command descriptions)
- !=============================================================
- ! Waiting.V - This is a small script to force the user to
- ! do nothing for 30 seconds. It is also an
- ! example of how to use the various control
- ! structures to accomplish the same goals.
- $x = 1
- $y = 0
- CALL drawit !----------------------------
- DO $a = 1 10 ! These
- CALL slowit ! three
- LOOP ! lines
- CALL drawit !----------------------------
- # again ! And
- IFVAL $x < 11 THEN ! \
- CALL slowit ! all
- $x = $x + 1 ! \
- GO again ! nine
- ELSE ! \
- GO notagain ! of
- ENDIF ! \
- # notagain ! these
- CALL drawit !----------------------------
- # lastone ! And
- CALL slowit ! \
- $y = $y + 1 ! these
- TESTVAL $y = 10 alldone ! \
- go lastone ! five
- # alldone !----------------------------
- exit start ! do the same thing
- # drawit !----------------------------
- TR
- DRAWWAITBAR 10
- RET
- # slowit
- DELAY 1
- TS "*"
- RET
- !=============================================================
-
-
-